/*
 * 
 * 
 * 
 */
package com.hboxs.asl.controller.admin;

import com.hboxs.asl.Pageable;
import com.hboxs.asl.entity.Member;
import com.hboxs.asl.service.DepositService;
import com.hboxs.asl.service.MemberService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * Controller - 预存款
 */
@Controller("adminDepositController")
@RequestMapping("/asl-admin/deposit")
public class DepositController extends BaseController {

    @Resource(name = "depositServiceImpl")
    private DepositService depositService;
    @Resource(name = "memberServiceImpl")
    private MemberService memberService;

    /**
     * 列表
     */
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public String list(Long memberId, Pageable pageable, ModelMap model) {
        Member member = memberService.find(memberId);
        if (member != null) {
            model.addAttribute("member", member);
            model.addAttribute("page", depositService.findPage(member, pageable));
        } else {
            model.addAttribute("page", depositService.findPage(pageable));
        }
        return "/admin/deposit/list";
    }

}